# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.OSConfig.V1.Model.PatchJob do
  @moduledoc """
  A high level representation of a patch job that is either in progress or has completed. Instance details are not included in the job. To paginate through instance details, use `ListPatchJobInstanceDetails`. For more information about patch jobs, see [Creating patch jobs](https://cloud.google.com/compute/docs/os-patch-management/create-patch-job).

  ## Attributes

  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Time this patch job was created.
  *   `description` (*type:* `String.t`, *default:* `nil`) - Description of the patch job. Length of the description is limited to 1024 characters.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - Display name for this patch job. This is not a unique identifier.
  *   `dryRun` (*type:* `boolean()`, *default:* `nil`) - If this patch job is a dry run, the agent reports that it has finished without running any updates on the VM instance.
  *   `duration` (*type:* `String.t`, *default:* `nil`) - Duration of the patch job. After the duration ends, the patch job times out.
  *   `errorMessage` (*type:* `String.t`, *default:* `nil`) - If this patch job failed, this message provides information about the failure.
  *   `instanceDetailsSummary` (*type:* `GoogleApi.OSConfig.V1.Model.PatchJobInstanceDetailsSummary.t`, *default:* `nil`) - Summary of instance details.
  *   `instanceFilter` (*type:* `GoogleApi.OSConfig.V1.Model.PatchInstanceFilter.t`, *default:* `nil`) - Instances to patch.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Unique identifier for this patch job in the form `projects/*/patchJobs/*`
  *   `patchConfig` (*type:* `GoogleApi.OSConfig.V1.Model.PatchConfig.t`, *default:* `nil`) - Patch configuration being applied.
  *   `patchDeployment` (*type:* `String.t`, *default:* `nil`) - Output only. Name of the patch deployment that created this patch job.
  *   `percentComplete` (*type:* `float()`, *default:* `nil`) - Reflects the overall progress of the patch job in the range of 0.0 being no progress to 100.0 being complete.
  *   `rollout` (*type:* `GoogleApi.OSConfig.V1.Model.PatchRollout.t`, *default:* `nil`) - Rollout strategy being applied.
  *   `state` (*type:* `String.t`, *default:* `nil`) - The current state of the PatchJob.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Last time this patch job was updated.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :createTime => DateTime.t() | nil,
          :description => String.t() | nil,
          :displayName => String.t() | nil,
          :dryRun => boolean() | nil,
          :duration => String.t() | nil,
          :errorMessage => String.t() | nil,
          :instanceDetailsSummary =>
            GoogleApi.OSConfig.V1.Model.PatchJobInstanceDetailsSummary.t() | nil,
          :instanceFilter => GoogleApi.OSConfig.V1.Model.PatchInstanceFilter.t() | nil,
          :name => String.t() | nil,
          :patchConfig => GoogleApi.OSConfig.V1.Model.PatchConfig.t() | nil,
          :patchDeployment => String.t() | nil,
          :percentComplete => float() | nil,
          :rollout => GoogleApi.OSConfig.V1.Model.PatchRollout.t() | nil,
          :state => String.t() | nil,
          :updateTime => DateTime.t() | nil
        }

  field(:createTime, as: DateTime)
  field(:description)
  field(:displayName)
  field(:dryRun)
  field(:duration)
  field(:errorMessage)
  field(:instanceDetailsSummary, as: GoogleApi.OSConfig.V1.Model.PatchJobInstanceDetailsSummary)
  field(:instanceFilter, as: GoogleApi.OSConfig.V1.Model.PatchInstanceFilter)
  field(:name)
  field(:patchConfig, as: GoogleApi.OSConfig.V1.Model.PatchConfig)
  field(:patchDeployment)
  field(:percentComplete)
  field(:rollout, as: GoogleApi.OSConfig.V1.Model.PatchRollout)
  field(:state)
  field(:updateTime, as: DateTime)
end

defimpl Poison.Decoder, for: GoogleApi.OSConfig.V1.Model.PatchJob do
  def decode(value, options) do
    GoogleApi.OSConfig.V1.Model.PatchJob.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.OSConfig.V1.Model.PatchJob do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
